//
//  AppDelegate.swift
//  拾舍清洁
//
//  Created by sky.wei on 2023/2/6.
//

import UIKit
import Bugly
import IQKeyboardManagerSwift

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window:UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        

        //bugly
        Bugly.start(withAppId: "f86a9c72be")
        
        //meiqia
//        MQManager.initWithAppkey("fdd00e04053dc478fe1f3e676f23eae1") { result, error in
//            if ((error == nil)) {
//                debugPrint("美洽 SDK：初始化成功")
//            } else {
//                debugPrint("error:\(String(describing: error))")
//            }
//        }

        
        IQKeyboardManager.shared.enable = true
        
        
        if(kIsLogin){
            var vc = UIViewController()
            vc = SSMainTabBarController()
            kUserDefaults.object(forKey: kUserTokenKey)
            window = UIWindow.init(frame: UIScreen.main.bounds)
            window?.rootViewController = vc
            
            window?.backgroundColor = UIColor.white
            window?.makeKeyAndVisible()

        }else{
            var vc = UIViewController()
            vc = SSPhoneLoginViewController()
            kUserDefaults.object(forKey: kUserTokenKey)
            window = UIWindow.init(frame: UIScreen.main.bounds)
            window?.rootViewController = vc
            
            window?.backgroundColor = UIColor.white
            window?.makeKeyAndVisible()

        }
        
        
        //其他启动任务
        UIApplication.shared.applicationLunch()
        
        UINavigationBar.appearance().tintColor = UIColor.orange
//        UITabBar.appearance().tintColor = UIColor.themeColor

        
        return true
    }
    
    func applicationDidBecomeActive(_ application: UIApplication) {
//        SSVersionMannager().getListNetwork()
    }
    
//    func applicationWillEnterForeground(_ application: UIApplication) {
//        MQManager.openMeiqiaService()
//    }
//
//    func applicationDidEnterBackground(_ application: UIApplication) {
//        MQManager.closeMeiqiaService()
//    }
  
}


